package com.boot.demo.controller;

import com.boot.demo.dao.UserDao;
import com.boot.demo.util.JsonResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * Created with LXD
 *
 * @author:Luhui
 * @qq:729913162
 * @Date:2018-08-11
 * @Time:10:59
 */
@RestController
public class UserController {
    @Autowired
    private UserDao userDao;

    @GetMapping("/getAll")
    public JsonResult getAll(){
//        throw new RuntimeException("故意抛异常");
        return new JsonResult(userDao.getAll(),200);
    }
//    @GetMapping("/getAll")
//    public List<User> getAll(){
//        return userDao.getAll();
//    }

    @GetMapping("/test")
    public String test(){
        return "8081";
    }
}
